/**
 * 
 */
package com.worksmap.core.action.user;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.worksmap.core.action.BaseController;
import com.worksmap.core.service.LoginService;

/**
 * 访问项目主页index.jsp
 * 用户主页不必登录即可查看
 * @author jack
 * 2013.7.5
 */
@Controller
@RequestMapping("/user")
public class UserIndexController extends BaseController {
	
	@Autowired
	LoginService loginService;
	
	/**
	 * 访问http://127.0.0.1/user 
	 * 初始页面默认到项目主页
	 * jack
	 * 2013-7-5
	 */
	@RequestMapping(value = "", method = RequestMethod.GET)
	public String index(HttpServletRequest request){
		logger.info("站点根目录访问跳转到我的主页.");
		if(loginService.isUserLogined(request)){
			request.setAttribute("currentUser", loginService.getCurrentUser(request));
		}else{
			logger.info("用户未登录");
		}
		return "user/index";
	}
	
}
